from flask import Flask, render_template,redirect,url_for
app = Flask(__name__)

@app.errorhandler(404)#传入错误码
def page_404(error): #接收错误信息作为参数
    print(error)
    return render_template("404.html")

if __name__ == '__main__':
    app.run()

